package sojo.com.inverter.enums;


/**
 * @author cheng_hu
 * @description: 告警1
 * @date 2023-02-25 14:04:43
 */
public enum AlarmEnum_1 {
    Alarm_0(0, 2001, "输入组串电压高", "重要"),
    Alarm_1(1, 2001, "输入组串电压高", "重要"),
    Alarm_2(2, 2002, "直流电弧故障[1]", "重要"),
    Alarm_3(3, 2011, "组串反接", "重要"),
    Alarm_4(4, 2012, "组串电流反灌", "提示"),
    Alarm_5(5, 2013, "组串功率异常", "提示"),
    Alarm_6(6, 2021, "AFCI自检失败[1]", "重要"),
    Alarm_7(7, 2031, "电网相线对PE短路", "重要"),
    Alarm_8(8, 2032, "电网掉电", "重要"),
    Alarm_9(9, 2033, "电网欠压", "重要"),
    Alarm_10(10, 2034, "电网过压", "重要"),
    Alarm_11(11, 2035, "电网电压不平衡", "重要"),
    Alarm_12(12, 2036, "电网过频", "重要"),
    Alarm_13(13, 2037, "电网欠频", "重要"),
    Alarm_14(14, 2038, "电网频率不稳定", "重要"),
    Alarm_15(15, 2039, "输出过流", "重要"),
    Alarm_16(16, 2040, "输出电流直流分量过大", "重要");


    private int bit; //bit值
    private int alarmId; //告警ID
    private String alarmName; //告警名称
    private String alarmLevel; //告警级别
    AlarmEnum_1(int bit, int alarmId, String alarmName, String alarmLevel) {
        this.bit = bit;
        this.alarmId = alarmId;
        this.alarmName = alarmName;
        this.alarmLevel = alarmLevel;
    }

    public static String getAlarmName(int bit) {
        for (AlarmEnum_1 alarmEnum : AlarmEnum_1.values()) {
            if (bit == alarmEnum.getBit()) {
                return alarmEnum.getAlarmName();
            }
        }
        return "";
    }

    public static int getAlarmId(int bit) {
        for (AlarmEnum_1 alarmEnum : AlarmEnum_1.values()) {
            if (bit == alarmEnum.getBit()) {
                return alarmEnum.getAlarmId();
            }
        }
        return -1;
    }

    public static String getAlarmLevel(int bit) {
        for (AlarmEnum_1 alarmEnum : AlarmEnum_1.values()) {
            if (bit == alarmEnum.getBit()) {
                return alarmEnum.getAlarmLevel();
            }
        }
        return "";
    }

    public String getAlarmLevel() {
        return alarmLevel;
    }

    public void setAlarmLevel(String alarmLevel) {
        this.alarmLevel = alarmLevel;
    }

    public int getBit() {
        return bit;
    }

    public void setBit(int bit) {
        this.bit = bit;
    }

    public int getAlarmId() {
        return alarmId;
    }

    public void setAlarmId(int alarmId) {
        this.alarmId = alarmId;
    }

    public String getAlarmName() {
        return alarmName;
    }

    public void setAlarmName(String alarmName) {
        this.alarmName = alarmName;
    }
}
